<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }

      .box1 {
        border: 1px solid red;
      }
      .box1 .left {
        background-color: blue;
        float: left;
        width: 200px;
        height: 100px;
      }
      .box1 .right {
        background-color: greenyellow;
        height: 100px;
        overflow: hidden; /*形成 BFC 保证了宽度计算是不包含left区域的，如果不形成 BFC，宽度有问题*/
      }

      .box2 {
        border: 1px solid darkslateblue;
      }
      .box2 .left {
        background-color: blueviolet;
        width: 200px;
        height: 100px;
        float: left;
      }
      .box2 .right {
        background-color: indianred;
        height: 100px;
        width: 100px;
        float: right;
      }
      .box2 .center {
        background-color: green;
        height: 100px;
        box-sizing: border-box;
        border: 2px solid gold;
        overflow: hidden; /*形成 BFC 保证了宽度计算是不包含 left 和 right 区域的，如果不形成 BFC，宽度有问题*/
      }
    </style>
  </head>
  <body>
    <!-- 两栏布局，左固定，右自适应 -->
    <div class="box1">
      <div class="left">left</div>
      <div class="right">right</div>
    </div>
    <hr style="height: 20px" />
    <!-- 三栏布局, 中间自适应,左右固定 -->
    <div class="box2">
      <div class="left">left</div>
      <div class="right">right</div>
      <div class="center">center</div>
    </div>
  </body>
</html>
